package com.fr.data.core.db.dialect;

import com.fr.base.StringUtils;
import java.sql.Connection;

public class SybaseDialect extends AbstractDialect
{
  private String defaultAutoIncrease = "identity";
  private int sysbaseFetchSize = 0;

  public String column2SQL(String paramString)
  {
    if (StringUtils.isBlank(paramString))
      return "";
    return paramString;
  }

  public int getFetchSize()
  {
    return this.sysbaseFetchSize;
  }

  public void setFetchSize(int paramInt)
  {
    this.sysbaseFetchSize = paramInt;
  }

  public String createSequence(Connection paramConnection, String paramString1, String paramString2, String paramString3)
  {
    return "NUMERIC(20)" + " " + this.defaultAutoIncrease;
  }

  public String columnType2SQL(int paramInt, String paramString)
  {
    switch (paramInt)
    {
    case -2:
      return "binary(" + paramString + ")";
    case -5:
    case 2:
      return "numeric(" + paramString + ")";
    case -4:
    case 2004:
      return "image";
    case 2005:
      return "text";
    case 91:
      return "datetime";
    case 93:
      return "datetime";
    case 8:
      return "float";
    case 4:
      return "int";
    case -1:
      return "text";
    case 92:
      return "datetime";
    case 1:
      return "char(" + paramString + ")";
    case 12:
      return "varchar(" + paramString + ")";
    case -3:
      return "varbinary(" + paramString + ")";
    case 3:
      return "decimal(" + paramString + ")";
    case -7:
      return "bit";
    }
    return super.columnType2SQL(paramInt, paramString);
  }

  protected String getIdentitySelectString()
    throws Exception
  {
    return "select @@identity";
  }

  public String quartzDelegateClass()
  {
    return "com.fr.third.org.quartz.impl.jdbcjobstore.MSSQLDelegate";
  }
}